<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=2" />
		<title>劳务队信用评价</title>
		<link rel="stylesheet" type="text/css" href="static/common.css"/>
		<style type="text/css">
			.top{position: fixed;z-index: 100;width: 100%;top: 0;left: 0;}
			
			/* .top p{line-height: 30px;font-size: 14px;background: #fff;text-indent: 10px;} */
			.contant{font-size: 14px;margin-top: 32px;}
			.table tr th:nth-child(3),.table tr td:nth-child(3){width: 50%;}
			.table tr td,.table tr th{width: 30%;}
			.table tr th:nth-child(1),.table tr td:nth-child(1),.table tr th:nth-child(2),.table tr td:nth-child(2){width: 10%;}
			/* .modal{position: fixed;width: 100%;height: 100%;z-index: 200;background: rgba(0,0,0,0.5);top: 0;}
			.modal .contants{width: 100%;height: 40%;position: fixed;bottom: 0;background: #fff;padding: 20px 0;box-sizing: border-box;}
 */
			/* .table tr td span{display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} */
			.model{position: fixed;top: 0;width: 100%;height: 100%;background:rgba(0,0,0,0.5);z-index: 120;}
			.model img{position: absolute;left: 50%;top: 50%;margin-left: -50px;margin-top: -40px;width: 100px;height: 80px;}
			/* .width{width: 160px} */
			/* .width1{width: 100px;} */
		</style>
	</head>
	<body>
		<div class="model">
			<img src="static/img/dom.gif" alt="">
		</div>
		<div class="top">
			<!-- <p id="select">选择季度：<span>2019-2</span></p> -->
			<table class="table">
				<thead>
					<tr>
						<th>级别</th>
						<th>排名</th>
						<th>劳务队/负责人</th>
						<th>队伍规模/类别</th>
					</tr>
				</thead>				
			</table>
		</div>
		<div class="contant">
			<table class="table">
				<tbody>
					
				</tbody>
			</table>
		</div>
		<!-- <div class="modal">
			<div class="contants" ></div>
			
		</div>
		<a id="a">aaaaa</a> -->
		
	</body>
</html>
<script src="static/js/jquery-1.8.3.js" type="text/javascript" charset="utf-8"></script>
<script src="static/dx.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var year = DX.getParam('year');
	
	$(document).ready(function(){
		$('title').text(year +'季度劳务队信用评价');
		
		if(!year){
			document.write('不能没有季度！');
			console.log('不能没有年份');return;
		}
		DX.ajax_method({
			'type':'POST',
			'param':{'year_quarter':year},
			'url':'/eva/dlc/sendCeoWithWechart',
			'callBack':function(res){
				if(res.code == 200){
					$('.model').hide();
					call(res.data);
				}
			}
		})
		

		function call(data){
			var str = '';
			$.each(data,function(i,val){
				
				var leave = '';
				var style = '';
				if (i < 50) {
					leave = 'A';
					style = '#86eba5';
				} else if (data.length > 50 && i > (data.length - 11)) {
					leave = 'C';
					style = '#e48383';
				} else {
					leave = 'B';
					style = '#f4f38c';
				};
				 str+='<tr>';
				// if(i==0 || i==50 || i==60){
				// 	var count;
				// 	var leave;
				// 	if(i < 50){
				// 		leave = 'A';
				// 		count = data.length > 50 ? 100 :data.length*2;
				// 	}else if(i>=60 &&data.length>60){
				// 		leave = 'B';
				// 		count = (data.length - 60)*2;
				// 	}else if(i >= 50 && i<60 && data.length >50){
				// 		leave = 'C';
				// 		count = data.length >= 60 ? 20 : (data.length - 50)*2;
				// 	}
				// 	str+='<td rowspan="'+count+'">'+leave+'</td>';
				// }
				str+='<td rowspan="2" style="background:'+style+'">'+leave+'</td>';
				str+='<td rowspan="2">'+val.row+'</td><td>'+ellText(val.teamName,12)+'</td><td>'+val.people+'</td>';
				str+='</tr><tr><td>'+val.contractor+'</td><td style="text-align: left;text-indent: 3px;">'+ellText(val.teamc,6)+'</td></tr>'
			})
			$('.table tbody').html(str);
		}
		/**
		 * 截取文字
		 * str 字符串
		 * number 截取多少位
		 */
		function ellText(str,number){
			var res = str.substr(0,number);
			
			if(str.length > number){
				res += '...';
			}
			return res;
		}
		
	})
</script>